package ossadaptor

import (
	"encoding/json"
	"fmt"
)

type QiniuOss struct {
	bindDomain string `json:"bind_domain"`
	accessKey  string `json:"access_key"`
	secretKey  string `json:"secret_key"`
}

func NewQiniuOss(bindDomain string, accessKey string, secretKey string) *QiniuOss {
	return &QiniuOss{
		bindDomain: bindDomain,
		accessKey:  accessKey,
		secretKey:  secretKey,
	}
}

func (oss *QiniuOss) String() (string, error) {
	bts, err := json.Marshal(oss)
	if err != nil {
		return "", err
	}
	return string(bts), nil
}

func (oss *QiniuOss) Parse(s string) error {
	err := json.Unmarshal([]byte(s), oss)
	if err != nil {
		return err
	}
	return nil
}

func (oss *QiniuOss) Put(file string, objName string) (*UploadRet, error) {
	ret := &UploadRet{}
	return ret, fmt.Errorf("not support")
}
